PIPE

Section: MINTLIB LIBRARY FUNCTIONS (3)
Updated: 3 March 1993
Index Return to Main Contents
 

NAME

pipe - create an interprocess communication channel  

SYNOPSIS

#include <unistd.h>

int pipe(int fd[2]);
 

DESCRIPTION

This function only works when MiNT is active. The pipe system call creates an I/O mechanism called a pipe and returns two file descriptors, fd[0] and fd[1]. fd[0] is opened for reading and fd[1] is opened for writing. When the pipe is written using the descriptor fd[1] up to 4096 bytes of data are buffered before the writing process is blocked. A read only file descriptor fd[0] accesses the data written to fd[1] on a FIFO (first-in-first-out) basis. The standard programming model is that after the pipe has been set up, two (or more) cooperating processes (created by subsequent fork calls) will pass data through the pipe using read and write. Read calls on an empty pipe (no buffered data) with only one end (all write file descriptors closed) returns an EOF (end of file). A SIGPIPE signal is generated if a write on a pipe with only one end is attempted.  

RETURN VALUES

pipe returns:
 0 on success. -1 on failure and sets errno to indicate the error.  

NOTES

in MiNT, pipes are really the same as FIFOs.  

SEE ALSO

fork(3), read(3), write(3), signal(3), Fpipe(2)


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUES
NOTES
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 11:14:58 GMT, June 22, 2025